home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 551-575 / disk_570 / gadtoolsbox / source / source.lha / Resources.c < prev    next >
C/C++ Source or Header  |  1991-11-04  |  3KB  |  112 lines

  1. /*-- AutoRev header do NOT edit!
  2. *
  3. *   Program         :   Resources.c
  4. *   Copyright       :   © Copyright 1991 Jaba Development
  5. *   Author          :   Jan van den Baard
  6. *   Creation Date   :   21-Sep-91
  7. *   Current version :   1.00
  8. *   Translator      :   DICE v2.6
  9. *
  10. *   REVISION HISTORY
  11. *
  12. *   Date          Version         Comment
  13. *   ---------     -------         ------------------------------------------
  14. *   21-Sep-91     1.00            System resources routines.
  15. *
  16. *-- REV_END --*/
  17.  
  18. #include "GTEd.h"
  19. #include "Protos.h"
  20.  
  21. /*
  22.  * External globals referenced.
  23.  */
  24. extern struct IntuitionBase *IntuitionBase;
  25. extern struct GfxBase       *GfxBase;
  26. extern struct CxBase        *CxBase;
  27. extern struct IconBase      *IconBase;
  28. extern struct UtilityBase   *UtilityBase;
  29. extern struct AslBase       *AslBase;
  30. extern struct NoFragBase    *NoFragBase;
  31. extern APTR                  MainVisualInfo;
  32. extern struct DrawInfo      *MainDrawInfo;
  33. extern struct DiskfontBase  *DiskfontBase;
  34.  
  35.  
  36. /*
  37.  * --- Open the libraries. I don't use the DICE
  38.  * --- auto-init possibility because I'de like
  39.  * --- this source to be compatible with other
  40.  * --- compilers.
  41.  */
  42. long OpenLibraries( void )
  43. {
  44.     if ( NOT( IntuitionBase = ( struct IntuitionBase * )
  45.         OpenLibrary( "intuition.library", 36l )))
  46.         return FALSE;
  47.     if ( NOT( GfxBase = ( struct GfxBase * )
  48.         OpenLibrary( "graphics.library", 36l )))
  49.         return FALSE;
  50.     if ( NOT( CxBase = ( struct CxBase * )
  51.         OpenLibrary( "commodities.library", 36l )))
  52.         return FALSE;
  53.     if ( NOT( IconBase = ( struct IconBase * )
  54.         OpenLibrary( "icon.library", 36l )))
  55.         return FALSE;
  56.     if ( NOT( UtilityBase = ( struct UtilityBase * )
  57.         OpenLibrary( "utility.library", 36l )))
  58.         return FALSE;
  59.     if ( NOT( AslBase = ( struct AslBase * )
  60.         OpenLibrary( "asl.library", 36l )))
  61.         return FALSE;
  62.     if ( NOT( NoFragBase = ( struct NoFragBase * )
  63.         OpenLibrary( "nofrag.library", NOFRAG_VERSION )))
  64.         return FALSE;
  65.     if ( NOT( DiskfontBase = ( struct DiskfontBase * )
  66.         OpenLibrary( "diskfont.library", 36l )))
  67.         return FALSE;
  68.     return TRUE;
  69. }
  70.  
  71. /*
  72.  * --- Close the libraries which are open.
  73.  */
  74. void CloseLibraries( void )
  75. {
  76.     if ( DiskfontBase )         CloseLibrary( DiskfontBase );
  77.     if ( NoFragBase )           CloseLibrary( NoFragBase );
  78.     if ( AslBase )              CloseLibrary( AslBase );
  79.     if ( UtilityBase )          CloseLibrary( UtilityBase );
  80.     if ( IconBase )             CloseLibrary( IconBase );
  81.     if ( CxBase )               CloseLibrary( CxBase );
  82.     if ( GfxBase )              CloseLibrary( GfxBase );
  83.     if ( IntuitionBase )        CloseLibrary( IntuitionBase );
  84. }
  85.  
  86. /*
  87.  * --- Get a screen it's font, drawinfo and visual info.
  88.  */
  89. long GetScreenInfo( struct Screen *screen )
  90. {
  91.     if ( NOT ( MainDrawInfo = GetScreenDrawInfo( screen )))
  92.         return FALSE;
  93.     if ( NOT ( MainVisualInfo = GetVisualInfo( screen, TAG_DONE )))
  94.         return FALSE;
  95.     return TRUE;
  96. }
  97.  
  98. /*
  99.  * --- Free a screen it's drawinfo and visual info.
  100.  */
  101. void FreeScreenInfo( struct Screen *screen )
  102. {
  103.     if ( MainDrawInfo ) {
  104.         FreeScreenDrawInfo( screen , MainDrawInfo );
  105.         MainDrawInfo = NULL;
  106.     }
  107.     if ( MainVisualInfo ) {
  108.         FreeVisualInfo( MainVisualInfo );
  109.         MainVisualInfo = NULL;
  110.     }
  111. }
  112.